package com.example.email.controller;

import com.example.email.service.MailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: 李振旺
 * @Date: 2021/07/05 15:49
 * @Description:
 */

@RequestMapping("send")
@RestController
public class SendEmailController {

    @Autowired
    private MailService mailService;

    /**
     * 邮件群发
     * @param to 群发人最少一个 邮件地址
     * @param subject 邮件主题
     * @param content 邮件内容
     * @return
     */
    @GetMapping("/sendEmail")
    public String sendMessage(@RequestParam String[] to, @RequestParam String subject, @RequestParam String content) {
        mailService.sendSimpleMail(to, subject, content);
        return "success";
    }

}
